import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

//import './assets/css/iconfont.css';
import "./assets/css/iconfont/iconfont.css";
//注册全局组件
import page from "./components/page.vue"
Vue.component("page",page);
import pageHeader from "./components/pageHeader.vue"
Vue.component("pageHeader",pageHeader);

import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper)

import axios from "axios";
Vue.prototype.$http=axios.create({
  baseURL:"https://www.softeem.xin"
});
//开发环境
//Vue.prototype.$http=axios;

//在vue的原型上面去扩展了方法 
//如果在原型上面扩展，则在内部可以直接调用this.方法名
Vue.prototype.showLoading=function(title){
  this.$store.dispatch("showLoading",title);
}
Vue.prototype.hideLoading=function(){
  this.$store.dispatch("hideLoading");
}
//扩展showActionSheet的方法到原型上面，这样就不用每次都调用vuex的mapActions
Vue.prototype.showActionSheet=function(config){
  this.$store.dispatch("showActionSheet",config);
}
Vue.prototype.hideActionSheet=function(){
  this.$store.dispatch("hideActionSheet");
}
//扩展原型  基本上所有的组件都会使用的方法 ，我们就扩展到原型上面，避免每一次都要mapActions
Vue.prototype.showPreviewImage=function(config){
	this.$store.dispatch("showPreviewImage",config);
}
Vue.prototype.hidePreviewImage=function(){
	this.$store.dispatch("hidePreviewImage");
}


//图片懒加载
import VueLazyload from 'vue-lazyload'
import loadImage from "./assets/images/loadingimg.gif"
Vue.use(VueLazyload,{
  loading:loadImage
});
//第三方消息交互插件 
import {Alert, Confirm, Toast} from 'wc-messagebox'
import 'wc-messagebox/style.css'
Vue.use(Alert);
Vue.use(Confirm);
Vue.use(Toast);

import viewContent from "./components/viewContent.vue";
Vue.component("viewContent",viewContent);

//加载全局扩展方法  methodExtend
import "./utils/methodExtend.js";

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
